package bman.game.battletank;

import static org.junit.Assert.*;

import org.junit.Test;

import bman.game.engine.GameConsole;
import bman.tools.JString;

public class BattleTankTests
{
	@Test
	public void testGetField()
	{
		String test = "ID:8,X:200,Y:195,Z:1,MISSING:,BEARING:NORTH,TYPE:greentank";
		
		assertEquals("8",GameConsole.getField(test,"ID"));
		assertEquals("200",GameConsole.getField(test,"X"));
		assertEquals("195",GameConsole.getField(test,"Y"));
		assertEquals("1",GameConsole.getField(test,"Z"));
		assertEquals("NORTH",GameConsole.getField(test,"BEARING"));
		assertEquals("greentank",GameConsole.getField(test,"TYPE"));
		assertEquals("Non-existent field should return null. ",
				null,GameConsole.getField(test,"NON_EXISTENT_FIELD"));
		
		
		String test2 = "ID:11,TYPE:explode,X:80,Y:105";
		assertEquals("105",GameConsole.getField(test2,"Y"));
	}
}

